home *** CD-ROM | disk | FTP | other *** search
/ Champak 49 / Volume 49 - JOGO DISK .iso / Games / honeytrouble.swf / scripts / frame_12 / DoAction.as
Encoding:
Text File  |  2007-09-27  |  3.7 KB  |  136 lines

  1. function getCurve()
  2. {
  3.    pos_array[0].rotation = pos_array[1].rotation;
  4.    delete line.onEnterFrame;
  5.    line1.clear();
  6. }
  7. function clearUseDraw()
  8. {
  9.    board_use.save_btn._visible = false;
  10.    board_use.setup_btn._visible = false;
  11.    board_use.crt_road_btn._visible = false;
  12.    board_use.play_btn._visible = false;
  13.    delete line.onEnterFrame;
  14.    curvePos = 0;
  15.    line.clear();
  16.    line1.clear();
  17.    line2.clear();
  18. }
  19. function postoRoad(pos_array)
  20. {
  21.    mouth_start._x = pos_array[0].x;
  22.    mouth_start._y = pos_array[0].y;
  23.    mouth._x = pos_array[pos_array.length - 1].x;
  24.    mouth._y = pos_array[pos_array.length - 1].y;
  25.    line.clear();
  26.    line1.clear();
  27.    line2.clear();
  28.    line.lineStyle(road_width,road_color,road_alpha);
  29.    line2.lineStyle(road_center_width,road_center_color,road_center_alpha);
  30.    line.moveTo(pos_array[0].x,pos_array[0].y);
  31.    line2.moveTo(pos_array[0].x,pos_array[0].y);
  32.    i = 1;
  33.    while(i < pos_array.length)
  34.    {
  35.       line.lineTo(pos_array[i].x,pos_array[i].y);
  36.       line2.lineTo(pos_array[i].x,pos_array[i].y);
  37.       i++;
  38.    }
  39.    line.cacheAsBitmap = true;
  40.    line1.cacheAsBitmap = true;
  41.    line2.cacheAsBitmap = true;
  42. }
  43. function show_pos(pos_array)
  44. {
  45.    var _loc2_ = new Array();
  46.    var _loc3_ = new Array();
  47.    _loc2_[0] = pos_array[0].x;
  48.    _loc3_[0] = pos_array[0].y;
  49.    i = 1;
  50.    while(i < pos_array.length)
  51.    {
  52.       _loc2_[i] = pos_array[i].x - pos_array[i - 1].x;
  53.       _loc3_[i] = pos_array[i].y - pos_array[i - 1].y;
  54.       i++;
  55.    }
  56.    var _loc4_ = String(_loc2_) + "|" + String(_loc3_);
  57.    trace("x_array=[" + _loc2_ + "]");
  58.    trace("y_array=[" + _loc3_ + "]");
  59.    return _loc4_;
  60. }
  61. function set_pos(x_array, y_array)
  62. {
  63.    var _loc1_ = new Array();
  64.    _loc1_[0] = new Object();
  65.    _loc1_[0].x = x_array[0];
  66.    _loc1_[0].y = y_array[0];
  67.    i = 1;
  68.    while(i < x_array.length)
  69.    {
  70.       _loc1_[i] = new Object();
  71.       _loc1_[i].x = x_array[i] + _loc1_[i - 1].x;
  72.       _loc1_[i].y = y_array[i] + _loc1_[i - 1].y;
  73.       i++;
  74.    }
  75.    return _loc1_;
  76. }
  77. function readyPlay()
  78. {
  79.    trace("ΦÄ╖σÅûΦ»ªτ╗åµò░τ╗ä" + pos_array.length);
  80.    pos_ID = 1;
  81.    mouth_start._x = pos_array[0].x;
  82.    mouth_start._y = pos_array[0].y;
  83.    mouth._x = pos_array[pos_array.length - 1].x;
  84.    mouth._y = pos_array[pos_array.length - 1].y;
  85.    i = 0;
  86.    while(i < pos_array.length)
  87.    {
  88.       if(i < pos_array.length - 1)
  89.       {
  90.          var _loc2_ = pos_array[i + 1].x - pos_array[i].x;
  91.          var _loc1_ = pos_array[i + 1].y - pos_array[i].y;
  92.          pos_array[i].rotation = Math.round(Math.atan2(_loc1_,_loc2_) * RtoA);
  93.          pos_array[i].dx = Math.round(_loc2_ / lineXishu * 100) / 100;
  94.          pos_array[i].dy = Math.round(_loc1_ / lineXishu * 100) / 100;
  95.          pos_array[i].dr = Math.round((pos_array[i].rotation - pos_array[i - 1].rotation) / lineXishu * 100) / 100;
  96.       }
  97.       else
  98.       {
  99.          pos_array[i].rotation = pos_array[i - 1].rotation;
  100.          pos_array[i].dx = 0;
  101.          pos_array[i].dy = 0;
  102.          pos_array[i].dr = 0;
  103.       }
  104.       pos_array[0].rotation = pos_array[1].rotation;
  105.       pos_array[0].dr = 0;
  106.       i++;
  107.    }
  108.    line.onEnterFrame = function()
  109.    {
  110.       if(!game_pause)
  111.       {
  112.          var _loc1_ = 0;
  113.          while(_loc1_ < 4)
  114.          {
  115.             readyPlay2();
  116.             _loc1_ = _loc1_ + 1;
  117.          }
  118.       }
  119.    };
  120. }
  121. function readyPlay2()
  122. {
  123.    line.attachMovie("dot","dot" + pos_ID,pos_ID);
  124.    line["dot" + pos_ID]._x = pos_array[pos_ID].x;
  125.    line["dot" + pos_ID]._y = pos_array[pos_ID].y;
  126.    pos_ID++;
  127.    if(pos_ID >= pos_array.length - 1)
  128.    {
  129.       delete line.onEnterFrame;
  130.       trace("game play");
  131.       speed_listener.initSpeed();
  132.       play();
  133.    }
  134. }
  135. var pos_ID = 0;
  136.